// Composables
import { createRouter, createWebHashHistory } from 'vue-router'
import type { RouteLocationNormalized } from "vue-router";
import jump from 'jump.js'
const routes = [
  {
    path: '/',
    redirect: "/home",
    component: () => import('@/layouts/default/Default.vue'),
    children: [
      {
        path: '/home',
        name: 'Home',
        component: () => import(/* webpackChunkName: "home" */ '@/views/Home.vue'),
      },
      {
        path: '/jxdd',
        name: 'jxdd',
        component: () => import(/* webpackChunkName: "home" */ '@/views/Jxdd.vue'),
      },
      {
        path: '/case',
        name: 'case',
        component: () => import(/* webpackChunkName: "home" */ '@/views/Case.vue'),
      },
      {
        path: '/message',
        name: 'message',
        component: () => import(/* webpackChunkName: "home" */ '@/views/Message.vue'),
      },
      {
        path: '/apply',
        name: 'apply',
        component: () => import(/* webpackChunkName: "home" */ '@/views/Apply.vue'),
      },
      {
        path: '/attractInvest',
        name: 'attractInvest',
        component: () => import(/* webpackChunkName: "home" */ '@/views/AttractInvest.vue'),
      },
      {
        path: '/aboutUs',
        name: 'aboutUs',
        component: () => import(/* webpackChunkName: "home" */ '@/views/AboutUs.vue'),
      },
      {
        path: '/downAPP',
        name: 'downAPP',
        component: () => import(/* webpackChunkName: "home" */ '@/views/downAPP.vue'),
      },
    ],
  },
  { path: "/:catchAll(.*)", name: "404", component: () => import("@/views/404.vue") }
]

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes,
})
router.afterEach((to: RouteLocationNormalized, from: RouteLocationNormalized) => {
  jump(window.pageYOffset*-1)
})
export default router
